/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fri.entiry;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author NguyenDongUIT
 */
@Entity
@Table(name = "fr_currency")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "FrCurrency.findAll", query = "SELECT f FROM FrCurrency f"),
    @NamedQuery(name = "FrCurrency.findByCurrencyId", query = "SELECT f FROM FrCurrency f WHERE f.currencyId = :currencyId"),
    @NamedQuery(name = "FrCurrency.findByCurrencyName", query = "SELECT f FROM FrCurrency f WHERE f.currencyName = :currencyName")})
public class FrCurrency implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "CurrencyId")
    private Integer currencyId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 3)
    @Column(name = "CurrencyName")
    private String currencyName;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "currencyId")
    private List<FrPaymentcode> frPaymentcodeList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "currencyId")
    private List<FrUsermoney> frUsermoneyList;

    public FrCurrency() {
    }

    public FrCurrency(Integer currencyId) {
        this.currencyId = currencyId;
    }

    public FrCurrency(Integer currencyId, String currencyName) {
        this.currencyId = currencyId;
        this.currencyName = currencyName;
    }

    public Integer getCurrencyId() {
        return currencyId;
    }

    public void setCurrencyId(Integer currencyId) {
        this.currencyId = currencyId;
    }

    public String getCurrencyName() {
        return currencyName;
    }

    public void setCurrencyName(String currencyName) {
        this.currencyName = currencyName;
    }

    @XmlTransient
    public List<FrPaymentcode> getFrPaymentcodeList() {
        return frPaymentcodeList;
    }

    public void setFrPaymentcodeList(List<FrPaymentcode> frPaymentcodeList) {
        this.frPaymentcodeList = frPaymentcodeList;
    }

    @XmlTransient
    public List<FrUsermoney> getFrUsermoneyList() {
        return frUsermoneyList;
    }

    public void setFrUsermoneyList(List<FrUsermoney> frUsermoneyList) {
        this.frUsermoneyList = frUsermoneyList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (currencyId != null ? currencyId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FrCurrency)) {
            return false;
        }
        FrCurrency other = (FrCurrency) object;
        if ((this.currencyId == null && other.currencyId != null) || (this.currencyId != null && !this.currencyId.equals(other.currencyId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fri.entiry.FrCurrency[ currencyId=" + currencyId + " ]";
    }
    
}
